# Declare the global variable outside the functions
initial_layout_global = 0

def get_jlayout():

    global initial_layout_global

    if initial_layout_global == 0:

        initial_layout_global = 1
        initial_layout = []
        initial_layout.append(json.loads(get_general_control_panel_layout()))

        initial_layout.append(json.loads(get_running_configuration_panel_layout()))

        tmp_layout_obj = json.loads(get_xmessage_app_layout())
        for obj in tmp_layout_obj :
            initial_layout.append(obj)

        initial_layout.append(json.loads(get_Decoy_configuration_panel_layout()))
        initial_layout_str = json.dumps(initial_layout)
        initial_layout_str = add_row_number_to_layout ( initial_layout_str )
        return initial_layout_str 

    else:
        return xrn_main_window_global.jlayout_str

root_tk_global = tk.Tk() 
root_tk_global.title(os.path.basename(__file__).replace(".py","")) 
root_tk_global.option_add("*Font", "Courier 10")

if __name__ == "__main__":

    initial_layout_global = 0
    xrn_main_window_global = xrn_main_window(root_tk_global,"")

    xrn_main_window_global.show() 

    # run main program
    root_tk_global.mainloop()

